import nltk
nltk.download('punkt_tab') # 第一次需要下载


from nltk.tokenize import word_tokenize
from nltk.text import Text
import matplotlib.pyplot as plt

input_str = ' Today\' s weather is good, very windy and sunny, \
we have no classes in the afternoon, We have to play basketball tomorrow \
  good good'

tokens = word_tokenize(input_str)
tokens = [s.lower() for s in tokens]
print(tokens)

t = Text(tokens)
print(t.count('good'))
print(t.index('good'))

print(t.plot(8))  # 前8

plt.show()
